﻿using System;
using System.Collections;
namespace PSE.Framework.Process
{
    public interface IHierarchicalProcessManager : IDisposable
    {
        bool IsInitialized { get; }
        string Name { get; }
        int ProcessId { get; }
        string FileName { get; }

        string Domain { get; }
        string UserName { get; }

        Uri ServiceAddress { get; }

        IHierarchicalProcess Parent { get; }
        IList Children { get; }

        void Initialize(string name);
        void Initialize(string name, ParentProcessStartInfo parentStartInfo);

        void WaitForExit();
        void Exit();

        bool IsChildStarted(string name);

        IHierarchicalProcess StartChild(string name, string fileName);
        IHierarchicalProcess StartChild(ChildProcessStartInfo childStartInfo);

        void CloseChild(string name);
        void CloseAllChildren();

        event EventHandler<ProcessEventArgs> ChildRestarted;
        event EventHandler<ProcessEventArgs> ChildClosed;

        event EventHandler<ProcessExceptionEventArgs> CheckIsAliveException;
    }
}
